<?php
class connection{
    
    private $_host;
    private $_username;
    private $_password;
    private $_database;
    private $_connection;
    
    
    public function __construct()
    {
        $this->_host        ='localhost';
        $this->_username    ='root';
        $this->_password    ='';
        $this->_database    ='db_mqap';
        $this->_connection  =null;
    }
    
    private function _initialize_connection()
    {
        try
        {
            $this->_connection = mysql_connect($this->_host,$this->_username,$this->_password);
            
            mysql_select_db($this->_database);
            
            return $this->_connection;
        }
        catch(exception $e)
        {
            throw $e;
        }
        
    }
    
    
    public function query( $sql = '')
    {
        try
        {
            return mysql_query($sql,$this->_initialize_connection());
        }
        catch(exception $e)
        {
            throw $e;
        }
    }
    
    
    
}